// Learn cc.Class:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/class.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/class/index.html
// Learn Attribute:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/reference/attributes.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/reference/attributes/index.html
// Learn life-cycle callbacks:
//  - [Chinese] http://www.cocos.com/docs/creator/scripting/life-cycle-callbacks.html
//  - [English] http://www.cocos2d-x.org/docs/editors_and_tools/creator-chapters/scripting/life-cycle-callbacks/index.html

cc.Class({
    extends: cc.Component,

    properties: {
        labDate: cc.Label,   //日期
        labMoney: cc.Label,  //元宝
        labState: cc.Label,  //房间类型
        _data: null,

    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {
        this.labMoney.string = LotteryUtils.moneytoServer(this._data.Rebate)+'元宝';
        this.labState.string = this._data.RoomName;
        var date =Utils.formateServiceDateStrToDate(this._data.Time);
        this.labDate.string = this.splitTwo(date.getFullYear())+'-'+this.splitTwo(date.getMonth() + 1)+'-'+ this.splitTwo(date.getDate());
    },

    splitTwo:function(num){
        return num.toString().length<2?"0"+num.toString():num.toString();
    },

    init: function(data){
        this._data = data;   
        //cc.log('Water',this._data);
    },

    // update (dt) {},
});
